﻿using System;
using System.Collections;
using System.Timers;
using CSharp.Libs.Koc.KernelModels.ItemClasses;
using CSharp.Libs.Koc;

namespace CSharp.Libs.Koc.KernelModels
{
    public class MarchSender
    {
        #region declarations
        private Kernel _AB = null;

        private Timer _tmrMarchReInit = null;

        private MarchTypes _mtType = MarchTypes.None;

        private Boolean _fMarchCommandActive = false;
        private Int32 _intLastMarchInternalUID = 0;

        #region enums
        public enum MarchTypes
        {
            None = 0,
            Transport = 1,
            Reinforce = 2,
            Scout = 3,
            Attack = 4,
            Reassign = 5
        }

        public enum TroopType
        {
            None = 0,
            SupplyTroop = 1,
            Militiaman = 2,
            Scout = 3,
            Pikeman = 4,
            Swordsman = 5,
            Archer = 6,
            Cavalry = 7,
            HeavyCavalry = 8,
            SupplyWaggon = 9,
            Ballista = 10,
            BatteringRam = 11,
            Catapult = 12
        }
        #endregion

        #region constants
        public const String PARAM_DEFAULT_CID = "";
        public const String PARAM_DEFAULT_TYPE = "";
        public const String PARAM_DEFAULT_KID = "";
        public const String PARAM_DEFAULT_X_COORD = "";
        public const String PARAM_DEFAULT_Y_COORD = "";
        public const String PARAM_DEFAULT_GOLD = "0";
        public const String PARAM_DEFAULT_R1 = "0";
        public const String PARAM_DEFAULT_R2 = "0";
        public const String PARAM_DEFAULT_R3 = "0";
        public const String PARAM_DEFAULT_R4 = "0";
        public const String PARAM_DEFAULT_ITEMS = "";
        #endregion

        #region events
        public delegate void ResultStringReceivedEventHandler(object sender, ResultStringReceivedEventArgs ea);
        public event ResultStringReceivedEventHandler ResultStringReceived;
        private void ThrowResultStringReceivedEvent(
            String Result)
        {
            if (ResultStringReceived != null)
            {
                ResultStringReceived(this, new ResultStringReceivedEventArgs(Result));
            }
        }
        #endregion
        #endregion



        #region constructor / terminator
        public MarchSender(
            Kernel AB)
        {
            _AB = AB;

            _AB.TM.FbParametersChanged += new TrafficMonitor.FbParametersChangedEventHandler(TM_FbParametersChanged);

            _tmrMarchReInit = new Timer(5000);//5sec timeout
            _tmrMarchReInit.Enabled = false;
            _tmrMarchReInit.Elapsed += new ElapsedEventHandler(_tmrMarchReInit_Elapsed);
        }

        ~MarchSender()
        {
            if(_tmrMarchReInit != null)
            {
                if(_tmrMarchReInit.Enabled)
                {
                    _tmrMarchReInit.Stop();
                }

                _tmrMarchReInit.Elapsed -= _tmrMarchReInit_Elapsed;
                _tmrMarchReInit.Dispose();
                _tmrMarchReInit = null;
            }

            if (_AB != null)
            {
                if(_AB.TM != null)
                {
                    _AB.TM.FbParametersChanged -= TM_FbParametersChanged;
                }

                _AB = null;
            }
        }
        #endregion



        #region event handling
        void TM_FbParametersChanged(object sender)
        {
            _InitCommand();
        }

        void _tmrMarchReInit_Elapsed(object sender, ElapsedEventArgs e)
        {
            _tmrMarchReInit.Stop();
            _StartMarch();
        }
        #endregion



        #region private functions
        /// <summary>_InitCommand</summary>
        /// <history>08.05.2011</history>
        private void _InitCommand()
        {
            try
            {
                if (!_AB.UH.URLMarch.URLMaybeValid)
                {
                    //Generate Command (without own parameters) out of getChat.php
                    _AB.UH.ParseURLMarch(_AB.UH.URLGetChat.GetURL().Replace(URLHolder.PHP_GET_CHAT, URLHolder.PHP_MARCH));

                    //Remove getChat.php specific parameters
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_CTYPE);
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_CTYPE_ID);
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_CUR_NEWEST_1);
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_CUR_NEWEST_2);
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_CUR_NEWEST_3);
                    _AB.UH.URLMarch.Parameters.Remove(URLHolder.PARAM_SID);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_CID))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_CID, PARAM_DEFAULT_CID);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_TYPE))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_TYPE, PARAM_DEFAULT_TYPE);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_KID))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_KID, PARAM_DEFAULT_KID);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_X_COORD))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_X_COORD, PARAM_DEFAULT_X_COORD);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_Y_COORD))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_Y_COORD, PARAM_DEFAULT_Y_COORD);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_GOLD))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_GOLD, PARAM_DEFAULT_GOLD);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_R1))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_R1, PARAM_DEFAULT_R1);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_R2))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_R2, PARAM_DEFAULT_R2);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_R3))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_R3, PARAM_DEFAULT_R3);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_R4))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_R4, PARAM_DEFAULT_R4);
                }

                if (!_AB.UH.URLMarch.Parameters.ContainsKey(URLHolder.PARAM_ITEMS))
                {
                    _AB.UH.URLMarch.Parameters.Add(URLHolder.PARAM_ITEMS, PARAM_DEFAULT_ITEMS);
                }
            }
            catch (Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }
        }

        /// <summary>_ResetCommand</summary>
        /// <history>08.05.2011</history>
        private void _ResetCommand()
        {
            try
            {
                // set all parameters to default
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_CID] =       PARAM_DEFAULT_CID;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_TYPE] =      PARAM_DEFAULT_TYPE;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_KID] =       PARAM_DEFAULT_KID;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_X_COORD] =   PARAM_DEFAULT_X_COORD;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_Y_COORD] =   PARAM_DEFAULT_Y_COORD;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_GOLD] =      PARAM_DEFAULT_GOLD;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_R1] =        PARAM_DEFAULT_R1;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_R2] =        PARAM_DEFAULT_R2;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_R3] =        PARAM_DEFAULT_R3;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_R4] =        PARAM_DEFAULT_R4;
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_ITEMS] =     PARAM_DEFAULT_ITEMS;

                // remove previously created troop count parameters.
                for (Int32 IDX = 1; IDX < 13; IDX++)
                {
                    if (_AB.UH.URLMarch.Parameters.ContainsKey("u" + IDX.ToString()))
                    {
                        _AB.UH.URLMarch.Parameters.Remove("u" + IDX.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }
        }

        /// <summary>_AddTroopType</summary>
        /// <param name="ttTroopType"></param>
        /// <param name="Amount"></param>
        /// <history>09.05.2011</history>
        private void _AddTroopType(
            TroopType ttTroopType,
            Int32 Amount)
        {
            try
            {
                if (ttTroopType != TroopType.None &&
                    Amount > 0)
                {
                    if (_AB.UH.URLMarch.Parameters.ContainsKey("u" + ttTroopType.GetHashCode()))
                    {//already exists. Just change value.
                        _AB.UH.URLMarch.Parameters["u" + ttTroopType.GetHashCode()] = Amount.ToString();
                    }
                    else
                    {//does not exist. Create new.
                        _AB.UH.URLMarch.Parameters.Add("u" + ttTroopType.GetHashCode(), Amount.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }
        }

        /// <summary>_GetTroopTypeValue</summary>
        /// <param name="ttTroopType"></param>
        /// <returns></returns>
        /// <history>09.05.2011</history>
        private String _GetTroopTypeValue(
            TroopType ttTroopType)
        {
            try
            {
                if (_AB.UH.URLMarch.Parameters.ContainsKey("u" + ttTroopType.ToString()))
                {
                    return _AB.UH.URLMarch.Parameters["u" + ttTroopType.ToString()];
                }
                else
                {
                    return "Parameter does not exist";
                }
            }
            catch (Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }

            return String.Concat("Error in ", this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
        }

        /// <summary>_ExecuteMarch</summary>
        /// <history>09.05.2011</history>
        private Boolean _ExecuteMarch(
            Int32 InternalUID)
        {
            try
            {
                if (!_fMarchCommandActive)
                {
                    //Check if any troops were defined
                    Boolean fTroopsDefined = false;
                    for (Int32 IDX = 1; IDX < 13; IDX++)
                    {
                        if (_AB.UH.URLMarch.Parameters.ContainsKey("u" + IDX.ToString()))
                        {
                            fTroopsDefined = true;
                            break;
                        }
                    }
                    
                    //Set march active
                    _intLastMarchInternalUID = InternalUID;

                    if (fTroopsDefined &&
                        _mtType != MarchTypes.None)
                    {
                        _AB.UH.URLMarch.Parameters[URLHolder.PARAM_TYPE] = _mtType.GetHashCode().ToString();

                        // maybe further checking

                        //start March
                        _StartMarch();
                    }
                    else
                    {
                        //No Troops defined Error :)
                        _fMarchCommandActive = false;

                        //Generate Result
                        ThrowResultStringReceivedEvent("No Troops defined. Couldn't Start march.");
                    }
                }
                else
                {
                    //march command active (no return value from POST yet)

                    //Generate Result
                    ThrowResultStringReceivedEvent("There is still an active march. Couldn't Start new one.");
                }
            }
            catch (Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }

            return false;
        }

        /// <summary>_MarchHandled</summary>
        /// <returns></returns>
        /// <history>13.05.2011</history>
        private void _StartMarch()
        {
            try
            {
                //Preparations
                String strResult = "";
                _fMarchCommandActive = true;

                //send march.php
                Hashtable htMarchAnswer = null;
                if(_AB.UH.URLMarch.GetAnswerHashtable(out htMarchAnswer))
                {
                    //GetAnswerHasttable returned true :)
                    MarchItem MI = _GetMarchItem(htMarchAnswer);
                    if(MI != null)
                    {
                        //Add march to List and database
                        _AB.Marches.Add(MI.marchId, MI);
                        _AB.DBOps.MarchesCreateItem(MI);

                        //Generate Result
                        strResult = String.Concat("March command successful (MarchID:", MI.marchId, ")");
                    }
                    else
                    {
                        //Generate Result
                        strResult = String.Concat("March command successful (but couldn't get converted to MarchItem)");
                    }

                    //Throw ResultReceived event
                    ThrowResultStringReceivedEvent(strResult);

                    //afterwards reset all
                    _ResetCommand();
                    _fMarchCommandActive = false;
                }
                else
                {
                    //GetAnswerHasttable returned false :(
                    String strErrCode = "";
                    String strMsg = "";

                    if(htMarchAnswer[constants.KEY_ERROR_CODE] != null)
                    {
                        strErrCode = htMarchAnswer[constants.KEY_ERROR_CODE].ToString();
                    }
                    if(htMarchAnswer[constants.KEY_MSG] != null)
                    {
                        strMsg = htMarchAnswer[constants.KEY_MSG].ToString();
                    }

                    //Timer starten und nochmal weg das Ding,
                    //wenn ein entsprechender Returncode kommt nur
                    switch(strErrCode)
                    {
                        case "210"://Maximal erlaubte Märsche vom aktuellem Versammlungspunkt erreicht
                            //Generate Result
                            strResult = String.Concat("March command reinitialized due to known error (Code: ", strErrCode, ", Message: '", strMsg, "')");
                            _tmrMarchReInit.Start();
                            break;

                        default:
                            //Generate Result
                            strResult = String.Concat("March command returned error and couldn't be reinitialized (Code: ", strErrCode, ", Message: '", strMsg, "')");

                            //afterwards reset all
                            _ResetCommand();
                            _fMarchCommandActive = false;
                            
                            break;
                    }

                    //Throw ResultReceived event
                    ThrowResultStringReceivedEvent(strResult);
                }
            }
            catch(Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }
        }

        /// <summary>_GetMarchItem</summary>
        /// <param name="htMarchItem"></param>
        /// <history>13.05.2011</history>
        private MarchItem _GetMarchItem(
            Hashtable htMarchItem)
        {
            try
            {
                MarchItem MI = new MarchItem(_AB, htMarchItem);

                //MI.marchId = _AB.GetHashtableValue(htMarchItem, constants.KEY_MARCH_ID, Kernel.VariableTypes.Int32);
                //MI.tileId = _AB.GetHashtableValue(htMarchItem, constants.KEY_TILE_ID, Kernel.VariableTypes.Int32);
                //MI.tileType = _AB.GetHashtableValue(htMarchItem, constants.KEY_TILE_TYPE, Kernel.VariableTypes.Int32);
                //MI.tileLevel = _AB.GetHashtableValue(htMarchItem, constants.KEY_TILE_LEVEL, Kernel.VariableTypes.Int32);
                //MI.initTS = _AB.GetHashtableValue(htMarchItem, constants.KEY_INIT_TS, Kernel.VariableTypes.Int32);
                //MI.distance = _AB.GetHashtableValue(htMarchItem, constants.KEY_DISTANCE, Kernel.VariableTypes.Double);
                //MI.speed = _AB.GetHashtableValue(htMarchItem, constants.KEY_SPEED, Kernel.VariableTypes.Int32);
                //MI.eta = _AB.GetHashtableValue(htMarchItem, constants.KEY_ETA, Kernel.VariableTypes.Int32);
                //MI.delay = _AB.GetHashtableValue(htMarchItem, constants.KEY_DELAY, Kernel.VariableTypes.Int32);
                //MI.liftFog = _AB.GetHashtableValue(htMarchItem, constants.KEY_LIFT_FOG, Kernel.VariableTypes.Int32);
                //MI.atkBoostTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_ATK_BOOST_TIME, Kernel.VariableTypes.Int32);
                //MI.atk2BoostTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_ATK2_BOOST_TIME, Kernel.VariableTypes.Int32);
                //MI.defBoostTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_DEF_BOOST_TIME, Kernel.VariableTypes.Int32);
                //MI.def2BoostTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_DEF2_BOOST_TIME, Kernel.VariableTypes.Int32);
                //MI.knightCombatBoostTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_KNIGHT_COMBAT_BOOST_TIME, Kernel.VariableTypes.Int32);
                //MI.marchUnixTime = _AB.GetHashtableValue(htMarchItem, constants.KEY_MARCH_UNIX_TIME, Kernel.VariableTypes.Int32);
                //MI.reqmicrotime = _AB.GetHashtableValue(htMarchItem, constants.KEY_REQ_MICRO_TIME, Kernel.VariableTypes.Int32);
                //MI.resmicrotime = _AB.GetHashtableValue(htMarchItem, constants.KEY_RES_MICRO_TIME, Kernel.VariableTypes.Int32);

                //MI.CityID = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_CID].ToString());
                //MI.MarchType = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_TYPE].ToString());
                //MI.KnightID = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_KID].ToString());
                //MI.DestinationXCoord = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_X_COORD].ToString());
                //MI.DestinationYCoord = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_Y_COORD].ToString());
                //MI.Gold = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_GOLD].ToString());
                //MI.R1 = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_R1].ToString());
                //MI.R2 = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_R2].ToString());
                //MI.R3 = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_R3].ToString());
                //MI.R4 = Int32.Parse(_AB.UH.URLMarch.Parameters[URLHolder.PARAM_R4].ToString());
                //MI.Items = _AB.UH.URLMarch.Parameters[URLHolder.PARAM_ITEMS].ToString();

                //String strKey = "";

                //for (Int32 IDX = 0; IDX < 12; IDX++)
                //{
                //    strKey = "u" + (IDX + 1).ToString();
                //    MI.UnitCount[IDX] = _AB.UH.URLMarch.GetParameterValueInt32(strKey);
                //}

                //strKey = "u1";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U1 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u2";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U2 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u3";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U3 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u4";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U4 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u5";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U5 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u6";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U6 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u7";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U7 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u8";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U8 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u9";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U9 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u10";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U10 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u11";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U11 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());
                //strKey = "u12";
                //if(_AB.UH.URLMarch.Parameters.ContainsKey(strKey))
                //    MI.U12 = Int32.Parse(_AB.UH.URLMarch.Parameters[strKey].ToString());

                return MI;
            }
            catch(Exception ex)
            {
                _AB.EC.AddException(ex, this.ToString(), _AB.EC.Tools.GetCurrentMethodName());
            }

            return null;
        }
        #endregion



        #region interface
        #region properties
        #region parameters
        public String CityID
        {
            get
            {
                return _AB.UH.URLMarch.Parameters[URLHolder.PARAM_CID];
            }
            set
            {
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_CID] = value;
            }
        }

        public MarchTypes Type
        {
            get
            {
                return _mtType;
            }
            set
            {
                _mtType = value;
            }
        }

        public String KnightID
        {
            get
            {
                return _AB.UH.URLMarch.Parameters[URLHolder.PARAM_KID];
            }
            set
            {
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_KID] = value;
            }
        }

        public String XCoord
        {
            get
            {
                return _AB.UH.URLMarch.Parameters[URLHolder.PARAM_X_COORD];
            }
            set
            {
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_X_COORD] = value;
            }
        }

        public String YCoord
        {
            get
            {
                return _AB.UH.URLMarch.Parameters[URLHolder.PARAM_Y_COORD];
            }
            set
            {
                _AB.UH.URLMarch.Parameters[URLHolder.PARAM_Y_COORD] = value;
            }
        }
        #endregion

        #region functional properties
        public Boolean MarchActive
        {
            get
            {
                return _fMarchCommandActive;
            }
        }

        public Boolean CanExecuteMarch
        {
            get
            {
                return !_fMarchCommandActive;
            }
        }

        public Int32 LastMarchInternalUID
        {
            get
            {
                return _intLastMarchInternalUID;
            }
        }
        #endregion
        #endregion

        #region methods
        public void ResetParameters()
        {
            _ResetCommand();
        }

        public void AddTroopType(
            TroopType ttTroopType,
            Int32 Amount)
        {
            _AddTroopType(ttTroopType, Amount);
        }

        public String GetTroopTypeValue(
            TroopType ttTroopType)
        {
            return _GetTroopTypeValue(ttTroopType);
        }

        public Boolean ExecuteMarch(
            Int32 InternalUID)
        {
            return _ExecuteMarch(InternalUID);
        }
        #endregion
        #endregion
    }
}
